package com.hfb.mashibing.alip8.designpattern._022state;

public class MainV2 {
    public static void main(String[] args) {

    }

    /**
     * 当追加新状态时，非常不方便
     */
    static class MM {
        String name;
        MMState state;

        public void smile(){ /* switch case */ state.smile(); }
        public void cry(){   /* switch case */ state.cry(); }
        public void say(){   /* switch case */ state.say(); }
    }
    static abstract class MMState {
        abstract void smile();
        abstract void cry();
        abstract void say();
    }

    static class MMHappyState extends MMState {
        @Override
        void smile() {
            System.out.println("MM Happy Smile");
        }
        @Override
        void cry() {
            System.out.println("MM Happy cry");
        }

        @Override
        void say() {
            System.out.println("MM Happy say");
        }
    }
    static class MMNervousState extends MMState {
        @Override
        void smile() {
            System.out.println("MM nervous Smile");
        }
        @Override
        void cry() {
            System.out.println("MM nervous cry");
        }

        @Override
        void say() {
            System.out.println("MM nervous say");
        }
    }
    static class MMSadState extends MMState {
        @Override
        void smile() {
            System.out.println("MM Sad Smile");
        }
        @Override
        void cry() {
            System.out.println("MM Sad cry");
        }

        @Override
        void say() {
            System.out.println("MM Sad say");
        }
    }



}
